<include file="public@header" />
</head>
<body>
<div class="wrap js-check-wrap">
    <ul class="nav nav-tabs">
        <li class="active"><a href="{:url('grade/index')}">所有成绩</a></li>
        <li><a href="{:url('grade/add')}">添加成绩</a></li>
    </ul>
    <form class="well form-inline margin-top-20"  method="get" action="{:url('grade/index')}">
        成绩名称：
        <input type="text" class="form-control" name="name" style="width:150px" value="{:input('request.name/s')}" placeholder="请输入班级">
        <input type="submit" class="btn btn-primary" value="搜索" />
        <a class="btn btn-danger" href="{:url('grade/index')}">清空</a>
    </form>
    <div>
        <a class="btn btn-success" href="{:url('grade/exportExcel')}">导出Excel</a>
        <a class="btn btn-success" id="import">导入Excel</a>
        <a class="btn btn-success" href="{:url('grade/download')}">下载导入模板</a>
    </div>
    <table class="table table-hover table-bordered">
            <thead>
                <tr>
                    <th width="80">ID</th>
                    <th>学科名称</th>
                    <th>学生姓名</th>
                    <th>成绩</th>
                    <th width="160">{:lang('ACTIONS')}</th>
                </tr>
            </thead>
           <tbody>
           <foreach name="grade" item="vo">
               <tr>
                   <td>{$key+1}</td>
                   <td>{$vo.subject_name}</td>
                   <td>{$vo.student_name}</td>
                   <td>{$vo.grade}</td>
                   <td><a class="btn btn-xs btn-success" href="{:url('grade/edit',array('id'=>$vo['id']))}">编辑</a>
                       <a class="btn btn-xs btn-danger js-ajax-delete" href="{:url('grade/delete',array('id'=>$vo['id']))}">删除</a>
                   </td>
               </tr>
           </foreach>
           </tbody>
        </table>
    <div class="pagination">{$page}</div>
</div>
<script src="__STATIC__/js/admin.js"></script>
<script src="__STATIC__/layui/layui.all.js"></script>
<script>
    layui.use('upload', function() {
        var upload = layui.upload;
        var uploadInst=upload.render({
            //要监听的元素
            elem:"#import",
            url:"{:url('grade/importExcel')}",
            accept:'file',
            //请求成功时
            done:function (res) {
                layer.msg('成功导入'+res.success+'条数据');
                setTimeout(function () {
                    location.reload();
                },2000)
            }
        });
    });
</script>
</body>
</html>